<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>

<html>
	<head>
	<%@ include file="/WEB-INF/views/include/common.jsp" %>
<meta name="AUTHOR" content="QroTech Inc." />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="CACHE-CONTROL" content="NO-CACHE"/>
		<meta http-equiv="PRAGMA" content="NO-CACHE"/>
		<meta name="ROBOTS" content="NOINDEX, NOFOLLOW"/>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<title>큐로넷::위치관제서비스</title>
		<link rel="stylesheet" href="${cssUrl }/header.css" type="text/css" />
		<link rel="stylesheet" href="${cssUrl }/map_carlook.css" type="text/css" />
		<link rel="stylesheet" href="${cssUrl }/map_popup_m_110.css" type="text/css" />
		<link rel="stylesheet" href="${cssUrl }/style.css" type="text/css" media="screen" charset="utf-8" />
		<link rel="stylesheet" href="${cssUrl }/m-110.css" type="text/css" />
		<!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>-->
<!-- 		<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script> -->
		<script type="text/javascript" src="http://jqueryrotate.googlecode.com/svn/trunk/jQueryRotate.js"></script>
		<script src="${jsUrl }/m-110.js"></script>
		<script src="${jsUrl }/iphone-style-checkboxes.js" type="text/javascript" charset="utf-8"></script>
		

<style>
.highlighter{
background-color:#FFFFCC
}
</style>
	</head>
	

<body>
<!-- 	<div  style="width:100%;height:100%;position:relative;"> -->
	<div class="headerContent upIndex5" style="position:relative;">
	
		<div class="pageHeader">
			<%@ include file="/WEB-INF/views/include/logoLink.jsp" %>
			<div id="pageNav">
				<ul>
<!-- 					<a href="/totalCarListMain"><li class="menu1"></li></a> -->
<!-- 					<a href="javascript:alert('관리자 권한이 필요합니다.')"><li class="menu2"></li></a> -->
<!-- 					<a href="/env/checkAreaMng"><li class="menu3"></li></a> -->
<!-- 					<a><li class="menu4"></li></a> -->
					<%@ include file="/WEB-INF/views/include/mainNavi.jsp" %>
				</ul>
			</div>
			<div id="pageNavRight">
				<%@ include file="/WEB-INF/views/include/titleLink.jsp" %>
			</div>
			
			
		</div>
		<div class="header_line"></div>
		</div><!--header end-->	
		<div class="topInfo upIndex5"  style="position:relative;height:30px;background-color:white;">
			
			<div class="titleList" height="30px"><span width="109px" >전체차량 지도보기</span></div>
			<div class="loading">	
				<ul>
					<li class="arrow_anim loadingToggle_play" ><img src="${imgUrl}/Arrow_Anim.gif"/></li>
					<li class="arrow_anim loadingToggle_stop" style="display:none"><img src="${imgUrl}/loading.png"/></li>
					<li class="arrow_anim"><label for="css_sized_container" title="4분마다 최신 정보로 자동 갱신합니다.">자동갱신</label></li>
					<li class="auto_update">
						<div class="css_sized_container"  title="4분마다 최신 정보로 자동 갱신합니다.">
							<input type="checkbox" id="css_sized_container" checked/>
						</div>
					</li>
				</ul>
			</div>
			
			
			
			<div class="save_screen">
				<a onclick="javascript:printScript();"><img src="${imgUrl}/buttonIcon_save.png"/>&nbsp;지도화면 인쇄</a>
			</div>
		</div>
		<div id="map" class="map" style=" ">
		<%@ include file="/WEB-INF/views/daumMap/daumMap.jsp" %>
			<div id="expandIcon_top" class=" upIndex5">
				<img src="${imgUrl }/wideIcon.png"/>
			</div>
		</div><!--map end -->
	
		
					
		<div class="slide_left upIndex4" style="left:0px;">
			
			
				<table id="wholetable" cellpadding="0" cellspacing="0">
					<tr>
						<td class="panel_left">
							<div class="panel_left_content">
								
								<div class="all_carlook">
									
									<div class="carlook_scrollWidth">
										<div class="carlook_box">
								<div class="carlook_head">
									<table cellpadding="0" cellspacing="0">
										
											<tr >
														<th width="30px">번호</th>
														<th width="85px">차량번호</th>
														<th width="55px">운전자명</th>
														<th width="*" class="carlook_lastTh_space">현재위치</th>
													</tr>
									</table>
								</div>
										<div class="carlook_body" id="all_carlook_scroll_height">
											<table id="table_users" cellpadding="0" cellspacing="0">
											<c:forEach items="${carList }" var="car" varStatus="status">
											<tr onclick="chooseCar(<c:out value="${car.carCode}"/>, <c:out value="${status.count}"/>, <c:out value="${car.rownum}"/>, true)">
												<td width="30px" class=""  ><c:out value="${status.count}"/></td>
												<td width="85px" class="" ><c:out value="${car.carRegiNumber}"/></td>
												<td width="55px" class="" ><c:out value="${car.name}"/></td>
												<td width="*" class="carlook_lastTd_space" ><c:out value="${car.address}"/></td>
											</tr>
											</c:forEach>	
												
									</table>
								</div><!--carlook_body end-->
										</div><!--carlook_box end-->
									</div><!--carlook_scrolWidth end-->
										
							</div><!-- carlook end-->
							</div><!--panel_left_content(white)-->
							
						</td><!--td_ panel_left-->
									<td id="expandIcon_left" ><div class="button_left upIndex4"><img id="buttonRotation" src="${imgUrl }/get_in.png"></div></td>
					</tr><!-- expandIcon_left and panel_left-->
				</table><!-- panel left table end-->
				
			</div><!-- slide end-->
		

<!-- 	</div>    -->

	<div id="carInfoWapper">
		<div id="carInfo" class="popup  upIndex3" style="display:none;  position:absolute;">
			<div class="popup_content" >
				<div class="popup_top">
						<div class="popup_plate" style="width:245px;"><span>차량번호 : </span><span id="carRegiNumber">01 조 5555</span></div>
						<div class="popup_see_map" style="margin-left:1.3em" onclick="gotoCarRootDetail()"><a style="font-weight:900;cursor:pointer;"  title="선택 차량 상세 지도 보기로 이동"><img src="${imgUrl }/buttonIcon_map.png"/>&nbsp;지도보기</a></div>
						<div class="popup_close" onclick="javascript:hideM110CarInfo();"><img src="${imgUrl }/popup_close.png"/></div>
				</div>	
							
							
						
				<div class="popup_images">
					<ul id="popup_images">
						<li class="icon"><img id="carTypeImg" src="${imgUrl}/icon_cartype_10.png" height="45px" width="45px" title="차량종류"/></li>
						<li class="icon"><img id="startUp" src="${imgUrl}/icon_keyon.png" height="45px" width="45px" title="차량 시동 상태"/></li>
						<li class="icon"><img id="checkAreaCode" src="${imgUrl}/icon_areain.png" height="45px" width="45px" title="관심지역"/></li>
						<li class="icon"><img id="run" src="${imgUrl}/icon_driving.png" height="45px" width="45px" title="주행상태"/></li>
						
						
					</ul>
				</div><!-- popup images end-->
				
				<div class="popup_table_box" style="width:100%; height:165px;">
						<div class="popup_table">
							<table id="infoTbl" class="popup_content" cellpadding="0" cellspacing="0" >
								<tr >
									<td class="popup_head" >현재위치</td>
									<td id="address" class="popup_body" colspan="3">경기도 성남시 분당구</td>
								</tr>
								<tr>
									<td class="popup_head">수신시각</td>
									<td id="detectTime" class="popup_body" colspan="3">2013-04-04 오전 10:27:58</td>
								</tr>
								<tr >
									<td class="popup_head" >운전자명<input type="hidden" id="carCode" name="carCode" value=""/></td>
									<td id="name" class="popup_body">김큐로넷</td>
									<td class="popup_head" >연락처</td>
									<td id="handPhone" class="popup_body">010-1234-1234</td>
								</tr>
								<tr>
									<td class="popup_head" >소속</td>
									<td id="deptName" class="popup_body">LG오토오아시스</td>
									<td class="popup_head" >차종</td>
									<td id="carTypeName" class="popup_body">덤프트럭</td>
								</tr>
								<tr>
									<td class="popup_head" >운반물 내용</td>
									<td id="baggageName" class="popup_body">식자재</td>
									<td class="popup_head" >1일 이동거리</td>
									<td id="dayDistance" class="popup_body">230Km</td>
								</tr>
								<tr>
									<td class="popup_head" >차량속도</td>
									<td id="speed" class="popup_body">100Km/h</td>
									<td class="popup_head" >전압</td>
									<td id="voltage" class="popup_body">12.6V</td>
								</tr>
							</table>
						
						</div><!--popup table1 end-->
						<div class="popup_title">상태</div>
						
							
						<div class="popup_table">
							<table id="statusTbl" class="popup_content" cellpadding="0" cellspacing="0">
								<tr>
									<td class="popup_head" >단말기상태</td>
									<td id="state" class="popup_body">ON</td>
									<td class="popup_head" >단말기번호</td>
									<td id="deviceID" class="popup_body">010-1234-1234</td>
								</tr>
								<tr>
									<td class="popup_head" >CDMA 상태</td>
									<td id="cdmastate" class="popup_body">정상</td>
									<td class="popup_head" >GPS 상태</td>
									<td id="gpsstate" class="popup_body">정상</td>
								</tr>
								<tr>
									<td class="popup_head" >온도</td>
									<td id="" class="popup_body"><span id="temperature"></span><span>C</span></td>
									<td class="popup_head" >습도</td>
									<td id="" class="popup_body"><span id="humidity"></span><span>%</span></td>
								</tr>
							</table>
						</div><!--popup table2 상태end-->
						<div class="popup_title" >목적지</div>
					
						<div class="popup_table">
								<table id="destiniTbl" class="popup_content_vertical"   cellpadding="0" cellspacing="0" width="100%">
									<thead>
									<tr >
										<td class="popup_ver_head" style="width:15%;">시각</td>
										<td class="popup_ver_head" style="width:20%;">목적지명</td>
										<td class="popup_ver_head">위치</td>
										<td class="popup_ver_head" style="width:20%;">통과여부</td>
									</tr>
									</thead>
									<tbody>
									<tr>
										<td id="arriDate" style="white-space: normal;">05시09분</td>
										<td id="name" style="white-space: normal;" >영남기업(주)</td>
										<td id="address" style="white-space: normal;">진안군 안천면</td>
										<td id="passed" style="white-space: normal;" >통과</td>
									</tr>
									</tbody>
									
								</table>
						</div><!--목적지 end -->
					
					
					</div><!--popup table box end-->
			</div><!--popup content end-->
		</div><!--popup end-->
	</div>
	<form id="frm" name="frm" method="post">
		<input type="hidden" id="carCode" name="carCode" value=""/>
	</form>
	
	<form id="theForm" name="theForm" method="post">
		<input type="hidden" id="carCode" name="carCode" value=""/>
		<input type="hidden" name="addressComponent1" id="addressComponent1"/>
		<input type="hidden" name="addressComponent2" id="addressComponent2"/>
		<input type="hidden" name="deptCode" id="deptCode"/>
		<input type="hidden" name="carType" id="carType"/>
		<input type="hidden" name="baggage" id="baggage"/>
		<input type="hidden" name="dev_CarDeviceCode" id="dev_CarDeviceCode"/>
		<input type="hidden" name="searchType" id="searchType"/>
		<input type="hidden" name="searchName" id="searchName" />
		<input type="hidden" id="customerCode" name="customerCode"/>
	</form>
	<script>
	var _this = this;
// 	var intervalTime = 4*1000;	//4 초
	var intervalTime = 4*60*1000;	//4 분


	var interval=self.setInterval(function(){clock()},intervalTime);	
	function clock()
	{
		logs('come to papa');
		if($('input[id=css_sized_container]').prop('checked')){
			var url = 'onlyCarListInMap.json';
			var param=$('#theForm').serialize();;
			
			logs('Timer works');
			AjaxPost(url, param, function(data){
				jsonLog(data);
				try{
					if(_infoWindow.m110.length>0){
						while((_infoWindow.m110.length>0)){
							var info = _infoWindow.m110.pop();
							info.close();	
						}
						_infoWindow.m110=[];
					}	
				}catch(e){}
				
// 				jsonLog(data.carList);
				hideM110CarInfo();
				clearMarkers();
				$(data.carList).each(function(ind){
					_this.carPositions[this['carCode']]['carCode']=this['carCode'];
					_this.carPositions[this['carCode']]['lat']=this['lat'];
					_this.carPositions[this['carCode']]['lng']=this['lng'];
					_this.carPositions[this['carCode']]['name']=this['name'];
					_this.carPositions[this['carCode']]['cardinal']=0;
					_this.carPositions[this['carCode']]['content']=this['carRegiNumber'];
					this['content']=this['carRegiNumber'];
					
					markerArray.push(makeMarkerM110(_this.carPositions[this['carCode']], this['carCode'], 'm110'));
					
// 					changeCarPosition2(this);
				});
				
			});
		}else{
			window.clearInterval(interval);
		}
	}
	window.onload = function() {
		makeMapTagSize();
		
		
		
		var mapSetting = {};
		mapSetting['lat']='<c:out value="${mapSetting.lat}"/>';
		mapSetting['lng']='<c:out value="${mapSetting.lng}"/>';
		mapSetting['zoom']='<c:out value="${mapSetting.zoom}"/>';
		
		
		mapSetting['swLat']='<c:out value="${mapSetting.swLat}"/>';
		mapSetting['swLng']='<c:out value="${mapSetting.swLng}"/>';
		mapSetting['neLat']='<c:out value="${mapSetting.neLat}"/>';
		mapSetting['neLng']='<c:out value="${mapSetting.neLng}"/>';
		logs('=================================================');
		jsonLog(mapSetting);
		logs('=================================================');
		mapInit_m110(mapSetting);
		
		$('.upIndex5').css('z-index',5);
		$('.upIndex4').css('z-index',4);
		$('.upIndex3').css('z-index',3);
		$('#carInfo').hide();
		
// 		_this.table_users = tableSync('table_users');	

		initBinding();	// 버튼 초기화

// 		callCarPositionsInMap();
		
		initTableSync();	// 테이블 연결
		
		
		_this.carPositions={};
		var count=0;
		var position4bound=new Array();
		<c:forEach items="${carList }" var="car" varStatus="status">
			var index = <c:out value="${status.count}"/>;
			position4bound[(index-1)]=new daum.maps.LatLng(<c:out value="${car.lat}"/>, <c:out value="${car.lng}"/>)
		
			count = '<c:out value="${car.carCode}"/>';
			_this.carPositions[count]={};
			_this.carPositions[count]['seq']='<c:out value="${car.rownum}"/>';
			
			_this.carPositions[count]['carCode']='<c:out value="${car.carCode}"/>';
			_this.carPositions[count]['lat']='<c:out value="${car.lat}"/>';
			_this.carPositions[count]['lng']='<c:out value="${car.lng}"/>';
			_this.carPositions[count]['name']='<c:out value="${car.name}"/>';
			_this.carPositions[count]['content']='<c:out value="${car.carRegiNumber}"/>';
			logs(count);
			if(parseInt(_this.carPositions[count]['lat'])>0 &&parseInt(_this.carPositions[count]['lng'])>0){
				logs('out my position : '+parseInt(_this.carPositions[count]['lat']));
				markerArray.push(makeMarkerM110(_this.carPositions[count], count, 'm110'));	
			}
			
		</c:forEach>
	
		

		/**
		* 관심지역	
		*/
		var checkAreaList=[];
		var checkArea={};
		<c:forEach items="${checkAreaList }" var="check" varStatus="status">
		checkArea={};
		checkArea.lat='<c:out value="${check.lat}"/>';
		checkArea.lng='<c:out value="${check.lng}"/>';
		checkArea.radius='<c:out value="${check.radius}"/>';	
		checkArea.name='<c:out value="${check.name}"/>';
		checkArea.address='<c:out value="${check.address}"/>';
		checkAreaList.push(checkArea);
		</c:forEach>
		/*
		* 관심지역 그리기.
		*/
		makeCheckArea(checkAreaList);
		try{
			makeCenter(position4bound);
			var boundInterval = setInterval(function(){
				relayout();
				
				window.clearInterval(boundInterval);
				},300);	
		}catch(e){logs(e);}
		
		var param = {};
		param['addressComponent1']='<c:out value="${param.addressComponent1}"/>';
		param['addressComponent2']='<c:out value="${param.addressComponent2}"/>';
		param['deptCode']='<c:out value="${param.deptCode}"/>';
		param['carCode']='<c:out value="${param.carCode}"/>';
		param['carTypeCode']='<c:out value="${param.carTypeCode}"/>';
		param['baggage']='<c:out value="${param.baggage}"/>';
		param['dev_CarDeviceCode']='<c:out value="${param.dev_CarDeviceCode}"/>';
		param['searchType']='<c:out value="${param.searchType}"/>';
		param['searchName']='<c:out value="${param.searchName}"/>';
		param['customerCode']='<c:out value="${param.customerCode}"/>';


		autoSync('theForm', param);
		_nowState = 'm110';
		
		moveMapTo(mapSetting['lat'], mapSetting['lng']);
// 		makeMapCenter_m110(mapSetting);
	};
	
	function setPopup_images(data){
		logs('setPopup_images');
		
		var popup_images = $('#popup_images');
		if(data && data.carType){
			var carType = parseInt(data.carType);
			popup_images.find('#carTypeImg').prop('src', '${imgUrl}/icon_cartype_'+carType+'.png');
		}
		if(data && data.startUp){
			var startUp = data.startUp;
			if(startUp == 'y'){
				popup_images.find('#startUp').prop('src', '${imgUrl}/icon_keyon.png');	
			}else{
				popup_images.find('#startUp').prop('src', '${imgUrl}/icon_keyoff.png');	
			}
		}
		
		if(data && data.run){
			var run = data.run;
			if(run == 'y'){
				popup_images.find('#run').prop('src', '${imgUrl}/icon_driving.png');	
			}else{
				popup_images.find('#run').prop('src', '${imgUrl}/icon_parking.png');	
			}
		}
		
		if(data && data.checkAreaCode){
			logs('data.checkAreaCode = '+data.checkAreaCode);
			if(data.checkAreaCode!='null'){
				popup_images.find('#checkAreaCode').prop('src', '${imgUrl}/icon_areain.png');	
			}else{
				popup_images.find('#checkAreaCode').prop('src', '${imgUrl}/icon_areaout.png');
			}
		}else{
			popup_images.find('#checkAreaCode').prop('src', '${imgUrl}/icon_areaout.png');
		}
	}
	
	
	function makeCenter(position4bound){
		var lat=0, lng=0, length=0;
		for(var index=0;index<position4bound.length;index++){
			if((position4bound[index].getLat()*1)<1) continue;
			
			lat += (position4bound[index].getLat()*1);
			lng += (position4bound[index].getLng()*1);
			length++;
		}
		logs('lat = '+lat+', lng = '+lng);
		lat/=length;
		lng/=length;
		
		moveMapTo(lat, lng);
	}
	
	function makeMapTagSize(){
		var side_width = $('.slide_left').css('width');
		var top_height = $('.topInfo').css('height');
		var window_width = $(window).width(); 
		var window_height = $(window).height();
		
		side_width = side_width.replace('px','');
		side_width*=1;
		
		top_height = top_height.replace('px','');
		top_height*=1;

		var btn_left = $('.button_left').css('width');
		
		btn_left = btn_left.replace('px','');
		btn_left*=1;
		
		side_width-=btn_left;
		
		logs('window_width = '+window_width+', side_width = '+side_width);
		logs('result = '+(window_width - side_width));
		
		$('.map').css('width', window_width - side_width);
		$('.map').css('height', window_height - top_height);		
	}
	
	function initTableSync(){
		_this.destiniTbl = tableSync('destiniTbl');
	}
	
	function initBinding(){

		$('.popup_close').unbind('click');
		$('.popup_close').bind('click', function(){
			$('#carInfo').hide();
		});
		
// 		$('#expandIcon_top').unbind('click');
// 		$('#expandIcon_top').bind('click', function(){
// 			if(s_dir) return;
			
// 			$('.button_left').trigger('click');
// 		});		
		
		$('.auto_update').unbind('click');
		$('.auto_update').bind('click', function(){
			logs('auto_update');
			if($('input[id=css_sized_container]').prop('checked')){
				interval=self.setInterval(function(){clock()},intervalTime);	
				$('.loadingToggle_play').show();
				$('.loadingToggle_stop').hide();
			}else{
				window.clearInterval(interval);
				$('.loadingToggle_play').hide();
				$('.loadingToggle_stop').show();
			}
		});
	}
	
	function callCarPositionsInMap(){
		if(typeof setCarPositionsInMap != 'function') return;
		setCarPositionsInMap();
	}
	
	function syncPopupDialog(carCode, rownum){

		try{
			var url='getCarDetail.json';
			var param={};
			param['carCode']=carCode;
			

			
			AjaxPost(url, param, function(data){
				logs('====================');
				jsonLog(data.carInfo);
				if(data.carInfo==null){
					data.carInfo={"name":"",
							"baggageName":"",
							"handPhone":"",
							"carTypeCode":"",
							"speed":"",
							"voltage":"",
							"groupName":"",
							"deptName":"",
							"carTypeName":"",
							"address":"",
							"carRegiNumber":"",
							"lng":"",
							"lat":"",
							"carCode":"",
							"customerCode":"",
							"checkAreaCode":"",
							"deptCode":"",
							"carGroupCode":"",
							"carDriverCode":"",
							"addressComponent1":"",
							"addressComponent2":"",
							"addressComponent3":"",
							"detectTime":"",
							"startUp":"",
							"run":"",
							"dayDistance":"",
							"totalDistance":"",
							"temperature":"",
							"humidity":""}; 
				}else{
					var phone = data.carInfo['handPhone'];
					data.carInfo['handPhone']=formatter.strTelNum_Check(phone);
					
					var speed = data.carInfo['speed'];
					if(speed=='null'||speed==null){
						speed='-';
					}
					data.carInfo['speed']=speed+'Km/h';
					data.carInfo['dayDistance']= (data.carInfo['dayDistance']/10)+"Km";
					var voltage = data.carInfo['voltage'];
					
					if(voltage=='null'||voltage==null){
						voltage=0;
					}
					
					data.carInfo['voltage']=voltage+'V';
					data.carInfo['detectTime'] = formatter.dateFormatYYMMDDHHMM(new Date(data.carInfo['detectTime']));
				}
// 				logs('====================');
// 				jsonLog(data.carStatus);
				if(data.carStatus==null){
					data.carStatus = {"state":"",
					"deviceID":"",
					"cdmastate":"",
					"gpsstate":"",
					"address":"",
					"carRegiNumber":"",
					"lng":"",
					"lat":"",
					"carCode":"",
					"customerCode":"",
					"checkAreaCode":"",
					"deptCode":"",
					"carGroupCode":"",
					"carDriverCode":"",
					"carTypeCode":"",
					"addressComponent1":"",
					"addressComponent2":"",
					"addressComponent3":"",
					"detectTime":"",
					"startUp":"",
					"run":"",
					"speed":"",
					"dayDistance":"",
					"totalDistance":"",
					"temperature":"",
					"humidity":"",
					"voltage":""};
				}else{
					data.carStatus['deviceID']=formatter.strTelNum_Check(data.carStatus['deviceID']);
					data.carStatus['state']= data.carStatus['state']==0?'off':'on';
					data.carStatus['cdmastate']= data.carStatus['cdmastate']==0?'이상':'정상';
					data.carStatus['gpsstate']= data.carStatus['gpsstate']==0?'이상':'정상';
				}
				try{
					autoSync('infoTbl', data.carInfo);
					
					setPopup_images(data.carInfo);
				}catch(e){
					logs('548');
					logs(e);
				}
				try{
					$('#carRegiNumber').text(data.carInfo['carRegiNumber']);	
				}catch(e){logs(e);}
				
				try{
					autoSync('statusTbl', data.carStatus);	
				}catch(e){
					logs('557');
					logs(e);
				}
				
				try{
					logs('data.carDestList size = '+data.carDestList.length);	
				}catch(e){logs(e);}
				
				if(data.carDestList.length>0){
					$(data.carDestList).each(function(ind){
						var time = this['destiniDate'];
						this['destiniDate'] = formatter.timeFormatHHMMSS(time);
						
					})
					
					jsonLog(data.carDestList);
					_this.destiniTbl.tableAutoSync(data.carDestList);	
				}else{
					$('#destiniTbl tbody').hide();
				}
				try{
					_m110Window['clickListner'+rownum]();
				}catch(e){logs('click error');}
				
				
				
				
				$('#carInfo').show();
				
			});
		}catch(e){
			logs('chooseCar2');logs(e);
		}
	}
	
	function chooseCar(carCode, count, rownum, option){
		logs('carCode'+carCode);
		if(typeof setDaumMapCenter != 'function') return;
		try{
			var lat = _this.carPositions[carCode]['lat'];
			var lng = _this.carPositions[carCode]['lng'];
			if(outOfKoreaRange(lat, lng)) return;
			setDaumMapCenter(lat, lng, (count-1), option);	
		}catch(e){
			logs('chooseCar1');logs(e);
		}
		
		syncPopupDialog(carCode, rownum);
		
		
	}
	
	
    var b_r=0, b_dir=true;
    $('.button_bottom').click(function() {
    	b_dir = !b_dir;
    	b_r = b_dir? 600 : 440;
        $('.slidebottom').stop().animate({top: b_r+'px'}, 800);
    });
    
    var s_r=0, s_dir=true;
    $('.button_left').click(function() {
    	
    	s_dir = !s_dir;
    	s_r = s_dir? -280 : 0;
        
        $('.slide_left').stop().animate({left: s_r+'px'}, 800);
    });
    
	function gotoCarRootDetail(){
		
		$('form[name=theForm]').find('#carCode').val($('#infoTbl').find('#carCode').val());
		$('form[name=theForm]').attr('action', '/map/carRootDetail').submit(); 
	}


	function focusInPaging(index){
		jsonLog(markerSetting.paging);
		var page = markerSetting.paging.page;
		if(!((page-1)*20<=index && page*20 >= index)){
			
			markerSetting.paging.makeNewPage = index;
			changePaging(Math.ceil(index/20));
			return;

		}
		$('#carInfo').show();
		var ret = $('#pagingTbl').find('tr td#seq').filter(function(ind){
			if($(this).text()==index)
				return $(this);
			$(this).parent().find('td').css('background-color', '');
		});
		var tr = $(ret).parent();
		
		$(tr).find('td').css('background-color','#FFFFCC');
		
		var trHeight = $(tr).height();
		$('.chart_body').scrollTop((index%21-1)*trHeight);
	}
	
	/**
	 * 화면 출력
	 */
	function printScript(){
		window.print();
	}
	</script>
</body>
</html>
